/* * Copyright (C) 2022 github.com/REAndroid * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.reandroid.xml; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SchemaAttr extends XMLAttribute { private static final String DEFAULT_XMLNS="xmlns"; private String mXmlns; private String mPrefix; public SchemaAttr(String prefix, String uri) { this(DEFAULT_XMLNS, prefix, uri); } public SchemaAttr(String xmlns, String prefix, String uri) { super(prefix, uri); this.set(xmlns, prefix, uri); } private void set(String xmlns, String prefix, String uri){ setXmlns(xmlns); if(XMLUtil.isEmpty(prefix)){ prefix=null; } setName(prefix); setUri(uri); } @Override public void setName(String fullName){ if(fullName==null){ setPrefix(null); return; } int i=fullName.indexOf(':'); if(i>0 && ihttps?://[^:\\s]+)(:(?([^:/\\s]+)))?\\s*$"); }