This commit is contained in:
guha%netscape.com 1999-01-06 17:38:37 +00:00
Родитель c4c4f8edb2
Коммит ce5f96afb9
8 изменённых файлов: 67 добавлений и 22 удалений

Просмотреть файл

@ -149,6 +149,7 @@ class DBArcsInOutCursor : public nsIRDFArcsOutCursor,
PRInt32 mCount;
nsIRDFArcsOutCursor* mOutCursor;
nsIRDFArcsInCursor* mInCursor;
nsVoidArray mResults;
public:
DBArcsInOutCursor(DataBase* db, nsIRDFNode* node, PRBool arcsOutp);
@ -246,9 +247,16 @@ DBArcsInOutCursor::Advance(void)
{
nsIRDFDataSource* ds;
while (mInCursor || mOutCursor) {
nsresult result = (mInCursor ? mInCursor->Advance() : mOutCursor->Advance());
if (NS_ERROR_RDF_CURSOR_EMPTY != result)
return NS_OK;
nsresult result = (mInCursor ? mInCursor->Advance() : mOutCursor->Advance());
while (NS_ERROR_RDF_CURSOR_EMPTY != result) {
nsIRDFNode* obj ;
GetValue(&obj);
if (mResults.IndexOf(obj) < 0) {
mResults.AppendElement(obj);
return NS_OK;
}
result = (mInCursor ? mInCursor->Advance() : mOutCursor->Advance());
}
if (mCount >= mDataBase->mDataSources.Count())
break;
@ -627,7 +635,7 @@ DataBase::HasAssertion(nsIRDFResource* source,
if (NS_FAILED(rv = ds->HasAssertion(source, property, target, tv, hasAssertion)))
return rv;
if (hasAssertion)
if (*hasAssertion)
return NS_OK;
if (NS_FAILED(rv = ds->HasAssertion(source, property, target, !tv, &hasNegation)))

Просмотреть файл

@ -439,7 +439,7 @@ ServiceImpl::GetResource(const char* uri, nsIRDFResource** resource)
nsresult rv;
if (NS_FAILED(factory->CreateResource(uri, &result)))
if (NS_FAILED(rv = factory->CreateResource(uri, &result)))
return rv;
const char* uri;
@ -550,8 +550,18 @@ ServiceImpl::GetNamedDataSource(const char* uri, nsIRDFDataSource** dataSource)
nsIRDFDataSource* ds =
NS_STATIC_CAST(nsIRDFDataSource*, PL_HashTableLookup(mNamedDataSources, uri));
if (! ds)
return NS_ERROR_ILLEGAL_VALUE;
if (! ds) {
size_t len = strlen(uri);
if ((len > 4) && (strcmp(&uri[len-4], ".rdf") == 0)) {
extern nsresult NS_NewRDFStreamDataSource(nsIRDFDataSource** result);
if (NS_OK != NS_NewRDFStreamDataSource(&ds)) {
return NS_ERROR_ILLEGAL_VALUE;
} else {
ds->Init(uri);
RegisterNamedDataSource(uri, ds);
}
} else return NS_ERROR_ILLEGAL_VALUE;
}
NS_ADDREF(ds);
*dataSource = ds;
@ -645,7 +655,7 @@ ServiceImpl::RegisterBuiltInNamedDataSources(void)
static DataSourceTable gTable[] = {
"rdf:bookmarks", NS_NewRDFBookmarkDataSource,
"rdf:mail", NS_NewRDFMailDataSource,
"rdf:mail", NS_NewRDFMailDataSource,
#if 0
"rdf:history", NS_NewRDFHistoryDataSource,
"rdf:lfs", NS_NewRDFLocalFileSystemDataSource,

Просмотреть файл

@ -266,8 +266,18 @@ rdf_Assert(nsIRDFService* service,
nsresult rv;
nsIRDFResource* predicate;
if (NS_FAILED(rv = service->GetUnicodeResource(predicateURI, &predicate)))
//XXX gross hack for now since I can't seem to get namespaces working in the parser
if (predicateURI.Equals("child") || predicateURI.Equals("subject")) {
nsAutoString prefix("http://home.netscape.com/NC-rdf#");
prefix.Append(predicateURI);
if (NS_FAILED(rv = service->GetUnicodeResource(prefix, &predicate)))
return rv;
} else {
if (NS_FAILED(rv = service->GetUnicodeResource(predicateURI, &predicate)))
return rv;
}
rv = rdf_Assert(service, ds, subject, predicate, objectURI);
NS_RELEASE(predicate);

Просмотреть файл

@ -61,7 +61,7 @@ include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
$(MAKE_INSTALL) ..\resources\LocalStore.rdf $(DIST)\bin\res\rdf\

Просмотреть файл

@ -743,8 +743,8 @@ nsRDFContentSink::GetIdAboutAttribute(const nsIParserNode& aNode,
const nsString& key = aNode.GetKeyAt(i);
SplitQualifiedName(key, nameSpaceID, attr);
if (nameSpaceID != mRDFNameSpaceID)
continue;
// if (nameSpaceID != mRDFNameSpaceID)
// continue;
// XXX you can't specify both, but we'll just pick up the
// first thing that was specified and ignore the other.
@ -799,8 +799,8 @@ nsRDFContentSink::GetResourceAttribute(const nsIParserNode& aNode,
const nsString& key = aNode.GetKeyAt(i);
SplitQualifiedName(key, nameSpaceID, attr);
if (nameSpaceID != mRDFNameSpaceID)
continue;
// if (nameSpaceID != mRDFNameSpaceID)
// continue;
// XXX you can't specify both, but we'll just pick up the
// first thing that was specified and ignore the other.
@ -833,7 +833,7 @@ nsRDFContentSink::AddProperties(const nsIParserNode& aNode,
// skip rdf:about, rdf:ID, and rdf:resource attributes; these
// are all "special" and should've been dealt with by the
// caller.
if ((nameSpaceID == mRDFNameSpaceID) &&
if ( //(nameSpaceID == mRDFNameSpaceID) &&
(attr.Equals(kTagRDF_about) ||
attr.Equals(kTagRDF_ID) ||
attr.Equals(kTagRDF_resource)))
@ -866,8 +866,8 @@ nsRDFContentSink::OpenRDF(const nsIParserNode& aNode)
SplitQualifiedName(aNode.GetText(), nameSpaceID, tag);
if (nameSpaceID != mRDFNameSpaceID)
return NS_ERROR_UNEXPECTED;
// if (nameSpaceID != mRDFNameSpaceID)
// return NS_ERROR_UNEXPECTED;
if (! tag.Equals(kTagRDF_RDF))
return NS_ERROR_UNEXPECTED;
@ -927,7 +927,7 @@ nsRDFContentSink::OpenObject(const nsIParserNode& aNode)
// description or a container.
PRBool isaTypedNode = PR_TRUE;
if (nameSpaceID == mRDFNameSpaceID) {
if (1 || (nameSpaceID == mRDFNameSpaceID)) {
isaTypedNode = PR_FALSE;
if (tag.Equals(kTagRDF_Description)) {
@ -1011,8 +1011,8 @@ nsRDFContentSink::OpenProperty(const nsIParserNode& aNode)
rv = rdf_Assert(mRDFService,
mDataSource,
GetContextElement(0),
rdfProperty,
rdfResource);
ns,
resourceURI);
}
}
@ -1045,8 +1045,8 @@ nsRDFContentSink::OpenMember(const nsIParserNode& aNode)
SplitQualifiedName(aNode.GetText(), nameSpaceID, tag);
if (nameSpaceID != mRDFNameSpaceID)
return NS_ERROR_UNEXPECTED;
//if (nameSpaceID != mRDFNameSpaceID)
// return NS_ERROR_UNEXPECTED;
if (! tag.Equals(kTagRDF_li))
return NS_ERROR_UNEXPECTED;

Просмотреть файл

@ -0,0 +1,8 @@
<RDF xml-ns:RDF="http://www.w3.org/TR/WD-rdf-syntax#"
xml-ns:nc="http://home.netscape.com/NC-rdf#">
<RDF:Description RDF:about="MailRoot">
<nc:child RDF:resource="http://www.netscape.com" nc:subject="Netscape Home Page!"/>
</RDF:Description>
</RDF>

Просмотреть файл

@ -880,6 +880,12 @@ static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
if (NS_FAILED(rv = db->AddDataSource(ds)))
goto done;
if (NS_FAILED(rv = service->GetNamedDataSource("resource:/res/rdf/LocalStore.rdf", &ds)))
goto done;
if (NS_FAILED(rv = db->AddDataSource(ds)))
goto done;
if (NS_FAILED(rv = service->GetResource("MailRoot", &root)))
goto done;

Просмотреть файл

@ -144,6 +144,7 @@ static NS_DEFINE_CID(kRDFHTMLDocumentCID, NS_RDFHTMLDOCUMENT_CID);
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kRDFTreeDocumentCID, NS_RDFTREEDOCUMENT_CID);
static NS_DEFINE_CID(kRDFSimpleContentSinkCID, NS_RDFSIMPLECONTENTSINK_CID);
static NS_DEFINE_CID(kCSSParserCID, NS_CSSPARSER_CID);
static NS_DEFINE_CID(kPresShellCID, NS_PRESSHELL_CID);
@ -213,6 +214,8 @@ NS_SetupRegistry()
nsRepository::RegisterFactory(kRDFInMemoryDataSourceCID, RDF_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kRDFServiceCID, RDF_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kRDFTreeDocumentCID, RDF_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kRDFSimpleContentSinkCID, RDF_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCSSParserCID, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kPresShellCID, LAYOUT_DLL, PR_FALSE, PR_FALSE);