Returns a new Nokogiri document for parsing.
199615
def document
      if !@document
        @document = Nokogiri::HTML(self.class.request_sncf(number, date))
        if !itinerary_available?
          @document = Nokogiri::HTML(self.class.request_sncf_itinerary(0))
        end
      end
      if @document.at('#no_results')
        fail TrainNotFound, @document.at('#no_results b').inner_html
      end
      @document
    end
1106781
def from_model(cls, document):
        
        return cls(meta={'id': document.id}, **cls.serialize(document))
811935
def parse(string)
      require 'rexml/document' unless defined?(REXML::Document)
      doc = REXML::Document.new(string)
      merge_element!({}, doc.root)
    end
799970
def from_mongo(cls, doc):
		""""""
		
		if doc is None:  # To support simplified iterative use, None should return None.
			return None
		
		if isinstance(doc, Document):  # No need to perform processing on existing Document instances.
			return doc
		
		if cls.__type_store__ and cls.__type_store__ in doc:  # Instantiate specific class mentioned in the data.
			cls = load(doc[cls.__type_store__], 'marrow.mongo.document')
		
		# Prepare a new instance in such a way that changes to the instance will be reflected in the originating doc.
		instance = cls(_prepare_defaults=False)  # Construct an instance, but delay default value processing.
		instance.__data__ = doc  # I am Popeye of Borg (pattern); you will be askimilgrated.
		instance._prepare_defaults()  # pylint:disable=protected-access -- deferred default value processing.
		
		return instance
729430
def parse(string)
      if string.blank?
        {}
      else
        doc = Nokogiri::XML(string)
        raise doc.errors.first if doc.errors.length > 0
        doc.to_hash
      end
    end
188652
def createDocument_(self, initDict = None) :
        ""
        if initDict is None :
            initV = {}
        else :
            initV = initDict

        return self.documentClass(self, initV)
307325
def newDocText(self, content):
        
        ret = libxml2mod.xmlNewDocText(self._o, content)
        if ret is None:raise treeError('xmlNewDocText() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
553577
def to_s
			return @normalized if @normalized

			doctype = nil
			if @element
				doc = @element.document
				doctype = doc.doctype if doc
			end

			@normalized = Text::normalize( @unnormalized, doctype )
			@unnormalized = nil
      @normalized
		end
240210
def newNode(name):
    
    ret = libxml2mod.xmlNewNode(name)
    if ret is None:raise treeError('xmlNewNode() failed')
    return xmlNode(_obj=ret)
517960
def _parsed_document(content, file_path)
      if file_path.nil? && content.nil?
        raise LoadError.new(nil, file_path, "Don't know what to do with nil values for both content and path")
      end

      content = if !file_path.nil? && content.nil?
                  File.read(file_path)
                else
                  content
                end

      parsed_document = parsed_documents[file_path]
      return parsed_document unless parsed_document.nil?

      parser = Parser.new(file_path: file_path)
      document = parser.parse(content)

      parser.dependency_paths.each do |path|
        new_path = _find_file!(path, file_path)
        next if new_path.nil?

        document.sub_documents << _parsed_document(nil, new_path)
      end

      document
    end
1269927
def to_xml_updates(value)
      return if options[:readonly]
      doc = Nokogiri::XML::Document.new
      if value.is_a?(Array)
        value.each do |sub_value|
          sub_field.to_xml_updates(sub_value) do |field_uri_xml, element_xml|
            element_wrapper = doc.create_element(sub_field.tag_name)
            element_wrapper << element_xml
            yield [
              field_uri_xml,
              element_wrapper
            ]
          end
        end
      elsif value.is_a?(Exchanger::Element)
        value.tag_name = tag_name
        if value.class.elements.keys.include?(:text)
          field = value.class.elements[:text]
          yield [
            field.to_xml_field_uri(value),
            field.to_xml(value)
          ]
        else
          # PhysicalAddress ?
          value.class.elements.each do |name, field|
            yield [
              field.to_xml_field_uri(value),
              field.to_xml(value, :only => [name])
            ]
          end
        end
      else # String, Integer, Boolean, ...
        yield [
          self.to_xml_field_uri(value),
          self.to_xml(value)
        ]
      end
    end
161278
public DocumentRepository newInstance() throws Exception {
        Class<?> klass = Class.forName( type );
        if (!DocumentRepository.class.isAssignableFrom(klass))
            throw new IllegalArgumentException("Not a " + DocumentRepository.class.getName() + ": " + type );

        Constructor<?> constructor = klass.getConstructor( String[].class );
        return (DocumentRepository) constructor.newInstance( new Object[]{ StringUtils.split(root,';') } );
    }
681710
def xpathNewContext(self):
        
        ret = libxml2mod.xmlXPathNewContext(self._o)
        if ret is None:raise xpathError('xmlXPathNewContext() failed')
        __tmp = xpathContext(_obj=ret)
        return __tmp
1199637
def parse_document(xmlcontent):
    

    document = etree.fromstring(xmlcontent)

    body = document.xpath('.//w:body', namespaces=NAMESPACES)[0]

    document = doc.Document()

    for elem in body:
        if elem.tag == _name('{{{w}}}p'):
            document.elements.append(parse_paragraph(document, elem))

        if elem.tag == _name('{{{w}}}tbl'):
            document.elements.append(parse_table(document, elem))

        if elem.tag == _name('{{{w}}}sdt'):
            document.elements.append(doc.TOC())

    return document
225313
function Document (document, name, parent) {
  if (!(this instanceof Document)) return new Document(document, name, parent);
  debug('document <%s> being built', name);
  Entry.call(this, document, name, parent);
  this._context = helpers.getAPI(this);
  this._currVal = {}; // 'this' object in evaluating user expressions
  this._this = this._currVal;
  Object.defineProperty(this._currVal, '_$parent', {
    get: function () {
      return parent._currVal;
    }
  });

  this._children = {};
  for (var childName in this._content) {
    this._children[childName] =
      helpers.build(this._content[childName], childName, this);
    (function (method) {
      var child = this._children[method];
      Object.defineProperty(this._currVal, method, {
        enumerable: true,
        get: function () {
          if (child._currVal === undefined)
            return child.next();
          return child._currVal; // doc and array's currval never empty
        }
      });
    }).call(this, childName);
  }
  debug('document <%s> build complete', name);
}
89689
def span_descendents(e)
      ns = Nokogiri::XML::NodeSet.new(Nokogiri::XML::Document.new)
      e.element_children.inject(ns) do |descendents, c|
        if HTML_INLINE_ELEMS.include?(c.name)
          descendents << c
          descendents += span_descendents(c)
        end
        descendents
      end
    end
406817
def parse
      parser = Parser.new Nokogiri::XML(xml)
      parser.parse
      parser
    end