зеркало из https://github.com/mozilla/pjs.git
Fixed default namespaces.
This commit is contained in:
Родитель
715da55dfe
Коммит
430bbb3c3f
|
@ -1222,10 +1222,15 @@ RDFContentSinkImpl::PushNameSpacesFrom(const nsIParserNode& aNode)
|
|||
if (0 == offset) {
|
||||
prefix.Truncate();
|
||||
|
||||
PRUnichar next = k.CharAt(sizeof(kNameSpaceDef)-1);
|
||||
// If the next character is a :, there is a namespace prefix
|
||||
if (':' == next) {
|
||||
k.Right(prefix, k.Length()-sizeof(kNameSpaceDef));
|
||||
if (k.Length() >= sizeof(kNameSpaceDef)) {
|
||||
// If the next character is a :, there is a namespace prefix
|
||||
PRUnichar next = k.CharAt(sizeof(kNameSpaceDef)-1);
|
||||
if (':' == next) {
|
||||
k.Right(prefix, k.Length()-sizeof(kNameSpaceDef));
|
||||
}
|
||||
else {
|
||||
continue; // it's not "xmlns:"
|
||||
}
|
||||
}
|
||||
|
||||
// Get the attribute value (the URI for the namespace)
|
||||
|
|
|
@ -414,7 +414,7 @@ RDFXMLDataSourceImpl::~RDFXMLDataSourceImpl(void)
|
|||
NameSpaceMap* doomed = mNameSpaces;
|
||||
mNameSpaces = mNameSpaces->Next;
|
||||
|
||||
NS_RELEASE(doomed->Prefix);
|
||||
NS_IF_RELEASE(doomed->Prefix);
|
||||
delete doomed;
|
||||
}
|
||||
|
||||
|
@ -461,8 +461,10 @@ rdf_BlockingParse(nsIURL* aURL, nsIStreamListener* aConsumer)
|
|||
// should be able to do by itself.
|
||||
|
||||
nsIInputStream* in;
|
||||
if (NS_FAILED(rv = NS_OpenURL(aURL, &in, nsnull /* XXX aConsumer */)))
|
||||
if (NS_FAILED(rv = NS_OpenURL(aURL, &in, nsnull /* XXX aConsumer */))) {
|
||||
NS_ERROR("unable to open blocking stream");
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
ProxyStream* proxy = new ProxyStream();
|
||||
|
@ -858,7 +860,7 @@ RDFXMLDataSourceImpl::AddNameSpace(nsIAtom* aPrefix, const nsString& aURI)
|
|||
if (! entry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(aPrefix);
|
||||
NS_IF_ADDREF(aPrefix);
|
||||
entry->Prefix = aPrefix;
|
||||
entry->URI = aURI;
|
||||
entry->Next = mNameSpaces;
|
||||
|
@ -939,7 +941,12 @@ RDFXMLDataSourceImpl::MakeQName(nsIRDFResource* resource,
|
|||
for (NameSpaceMap* entry = mNameSpaces; entry != nsnull; entry = entry->Next) {
|
||||
if (uri.Find(entry->URI) == 0) {
|
||||
nameSpaceURI = entry->URI;
|
||||
entry->Prefix->ToString(nameSpacePrefix);
|
||||
if (entry->Prefix) {
|
||||
entry->Prefix->ToString(nameSpacePrefix);
|
||||
}
|
||||
else {
|
||||
nameSpacePrefix.Truncate();
|
||||
}
|
||||
uri.Right(property, uri.Length() - nameSpaceURI.Length());
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче