Skip to content
Snippets Groups Projects
XMLDOMUtil.cpp 23.6 KiB
Newer Older
PeiYong Zhang's avatar
PeiYong Zhang committed
				target << XMLStrL(" SYSTEM \"") << id << XMLStrL("\"");
			id = doctype.getInternalSubset();
			if (id !=0)
				target << XMLStrL(" [ ") << id  << XMLStrL("]");
			target  << XMLStrL(">");
            break;
        }
		case DOM_Node::ENTITY_NODE:
        {
			target << XMLStrL("<!ENTITY ") << nodeName;
			DOMString id = ((DOM_Entity &)toWrite).getPublicId();
			if (id != 0)
				target << XMLStrL("PUBLIC \"") << id << XMLStrL("\"");
			id = ((DOM_Entity &)toWrite).getSystemId();
			if (id != 0)
				target << XMLStrL("SYSTEM \"") << id << XMLStrL("\"");
			id = ((DOM_Entity &)toWrite).getNotationName();
			if (id != 0)
				target << XMLStrL("NDATA \"") << id << XMLStrL("\"");

            break;
        }
        case DOM_Node::XML_DECL_NODE:
        {
            target << XMLStrL("<?xml version=") << ((DOM_XMLDecl &)toWrite).getVersion();
            DOMString str = ((DOM_XMLDecl &)toWrite).getEncoding();
            if (str != 0)
                target << XMLStrL(" encoding=") << str;
            str = ((DOM_XMLDecl &)toWrite).getStandalone();
            if (str != 0)
                target << XMLStrL(" standalone=") << str;
            target << XMLStrL("?>");
            break;
        }
        default:
            target << XMLStrL("<!-- Unrecognized node type -->");
    }
	return target;
}

void GetXML(const DOM_Node &node, _bstr_t &text)
{
	xmlstream stream;
	stream << node;
	text.Assign(stream.SysAllocString());
}